var orderDetailVue = new Vue({
	el: "#app",
	data: {
		orderNo: "",
		order: {},
		openid:""
	},
	methods: {
		getDetail: function() {
			var t = this;
			wx.showLoading({
				title: "加载中...",
				mask: !1
			}), this.$http.post(baseUrl + "order/detail", {
				orderNo: this.orderNo
			}).then(function(a) {
				wx.hideLoading();
				var e = a.data;
				if (e.success) {
					t.order = e.data;
					var express = {};
					express.expressCompany = t.order.expressCompany;
					express.expressNo = t.order.expressNo;
					express.expressInfo = t.order.expressInfo;
					localStorage.setItem("express",JSON.stringify(express));
				} else {
					wx.showToast({
						title: e.description,
						icon: "none",
						duration: 2e3,
						mask: !0
					});
				}
			}).catch(function(t) {
				wx.hideLoading(), console.log(t), wx.showToast({
					title: "网络错误，请稍后重试",
					icon: "none",
					duration: 2e3,
					mask: !0
				});
			});
		},
		todetail: function(t) {
			wx.showLoading({
				title: "加载中..."
			})
			this.$http.post(baseUrl + "wap/product/one", {
				productGuid: t.guid
			}).then(function(e) {
				wx.hideLoading();
				var a = e.data;
				Jump.to(page.product.detail, "product=" + JSON.stringify(a.data));
			}).catch(function(t) {
				wx.hideLoading(), wx.showToast({
					title: "网络错误，请稍后重试",
					icon: "none",
					duration: 2e3,
					mask: !1
				});
			});
		},
		cancel_order: function() {
			var a = this;
			wx.showLoading({
				title: "加载中...",
				mask: !0
			}), this.$http.post(baseUrl + "order/delete", {
				orderNo: a.orderNo
			}).then(function(t) {
				var s = t.data;
				wx.hideLoading(), s.success ? (wx.showToast({
					title: "取消订单成功",
					icon: "none",
					duration: 2e3,
					mask: !1
				}), setTimeout(function() {
					Jump.back();
				}, 1e3)) : wx.showToast({
					title: s.description,
					icon: "none",
					duration: 2e3,
					mask: !1
				});
			}).catch(function(t) {
				wx.hideLoading(), wx.showToast({
					title: "网络错误，请稍后重试",
					icon: "none",
					duration: 2e3,
					mask: !1
				});
			});
		},
		receive: function() {
			var t = this;
			wx.showModal({
				title: "确认收货",
				content: "亲！确认收货？",
				confirm: function() {
					wx.showLoading({
						title: "加载中...",
						mask: !0
					});
					t.$http.post(baseUrl + "order/receive", {
						orderNo: t.order_id
					}).then(function(t) {
						var a = t.data;
						wx.hideLoading(), a.success ? (wx.showToast({
							title: "确认收货成功",
							icon: "none",
							duration: 2e3,
							mask: !1
						}), setTimeout(function() {
							t.getDetail();
						}, 1e3)) : wx.showToast({
							title: a.description,
							icon: "none",
							duration: 2e3,
							mask: !1
						});
					}).catch(function(t) {
						wx.hideLoading(), wx.showToast({
							title: "网络错误，请稍后重试",
							icon: "none",
							duration: 2e3,
							mask: !1
						});
					});
				},
			});
		},
		evaluate:function(){
			Jump.to(page.eval.evaluate,"orderNo="+this.order.orderNo+"&products="+JSON.stringify(this.order.orderDetails)+"&type=prod");
		},
		toPay:function(){
			/* Jump.to(page.pay.type,"orderNo="+this.orderNo); */
			var that = this;
			wx.showLoading({title:"支付中..."});
			this.$http.post(baseUrl+"order/pay/appWx",{
				orderNo:this.orderNo
			}).then(function(e){
				wx.hideLoading();
				var r = e.data;
				if(!r.success){
					 wx.showToast({
						title: r.description,
						icon: "none",
						duration: 2e3,
						mask: !0
					});
				}else{
					plus.webview.create(r.data, 'prod_pay_url3', {additionalHttpHeaders:{Referer:'https://app.meijiangzi.com/'}});
					Jump.to(page.pay.result, 'orderNo='+that.orderNo+'&orderType=mjz');
					// window.location.href=r.data;
				}
			})
		}
	},
	created: function() {
		var orderNo = URLParam.get("orderNo");
		this.orderNo = orderNo;
		this.getDetail();
		this.openid=localStorage.getItem("open_id");
	}
});
